<template>
	<el-table :data="tableData" style="width: 100%" :header-cell-style="{background:'#f2f2f2'}" :default-sort="{prop: 'date', order: 'descending'}">
		<el-table-column prop="intdate" label="积分日期" sortable width="220">
		</el-table-column>
		<el-table-column prop="intchange" label="变动" width="180">
		</el-table-column>
		<el-table-column prop="intaddress" label="来源" :formatter="formatter">
		</el-table-column>
	</el-table>
</template>

<script>
	export default {
		data() {
			return {
				tableData: [
				// 	{
				// 	date: '2016-05-02 16:20:00',
				// 	name: '+100',
				// 	address: '消费赠送'
				// }, {
				// 	date: '2016-05-04 16:20:00',
				// 	name: '+100',
				// 	address: '消费赠送'
				// }, {
				// 	date: '2016-05-01 16:20:00',
				// 	name: '-100',
				// 	address: '积分商城兑换'
				// }, {
				// 	date: '2016-05-03 16:20:00',
				// 	name: '-100',
				// 	address: '积分商城兑换'
				// }, {
				// 	date: '2016-05-03 16:20:00',
				// 	name: '-100',
				// 	address: '积分商城兑换'
				// }, {
				// 	date: '2016-05-03 16:20:00',
				// 	name: '-100',
				// 	address: '积分商城兑换'
				// }, {
				// 	date: '2016-05-03 16:20:00',
				// 	name: '-100',
				// 	address: '积分商城兑换'
				// }, {
				// 	date: '2016-05-03 16:20:00',
				// 	name: '-100',
				// 	address: '积分商城兑换'
				// }
				]
			}
		},
		methods: {
			formatter(row) {
				return row.intaddress;
			}
		},
		created(){
			var _this = this;
			this.$axios({
				method: 'post',
				url: 'http://localhost:3000/recentlook/int',
				// data:{userphone:userphone},
				headers: {
					'Content-Type': 'application/x-www-form-urlencoded'
				},
			}).then((response) => {
				_this.tableData = response.data.result;
				_this.code = response.data.code;
			}).catch(function(error) {
				_this.data = error;
			});
		}
	}
</script>

<style>
	.el-table{
		border:1px solid #E7E7E7;
	}
	.el-table th,.el-table td{
		text-align: center !important;
	}
</style>
